FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["LiuQiuRong.Chat.Web/LiuQiuRong.Chat.Web.csproj", "LiuQiuRong.Chat.Web/"]
COPY ["LiuQiuRong.Chat.Businesses/LiuQiuRong.Chat.Businesses.csproj", "LiuQiuRong.Chat.Businesses/"]
COPY ["LiuQiuRong.Chat.Utilities/LiuQiuRong.Chat.Utilities.csproj", "LiuQiuRong.Chat.Utilities/"]
COPY ["LiuQiuRong.Chat.Repositories/LiuQiuRong.Chat.Repositories.csproj", "LiuQiuRong.Chat.Repositories/"]
COPY ["LiuQiuRong.Chat.Models/LiuQiuRong.Chat.Models.csproj", "LiuQiuRong.Chat.Models/"]
COPY ["LiuQiuRong.Chat.Infrastructures/LiuQiuRong.Chat.Infrastructures.csproj", "LiuQiuRong.Chat.Infrastructures/"]
RUN dotnet restore "LiuQiuRong.Chat.Web/LiuQiuRong.Chat.Web.csproj"
COPY . .
WORKDIR "/src/LiuQiuRong.Chat.Web"
RUN dotnet build "LiuQiuRong.Chat.Web.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "LiuQiuRong.Chat.Web.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "LiuQiuRong.Chat.Web.dll"]